$OpenBSD: patch-config_c,v 1.2 2013/06/07 20:06:03 dcoppa Exp $
--- config.c.orig	Tue May 24 17:49:29 2005
+++ config.c	Fri Jun  7 16:08:11 2013
@@ -241,11 +241,10 @@ struct vifconfig *parsePhyintToken() {
     tmpPtr->allowednets = NULL;
 
     // Make a copy of the token to store the IF name
-    tmpPtr->name = (char *)malloc( sizeof(char) * strlen(token) );
+    tmpPtr->name = strdup(token);
     if(tmpPtr->name == NULL) {
         log(LOG_ERR, 0, "Out of memory.");
     }
-    strcpy(tmpPtr->name, token);
 
     // Set the altnet pointer to the allowednets pointer.
     anetPtr = &tmpPtr->allowednets;
@@ -328,29 +327,18 @@ struct vifconfig *parsePhyintToken() {
 */
 struct SubnetList *parseSubnetAddress(char *addrstr) {
     struct SubnetList *tmpSubnet;
-    char        *tmpStr;
     uint32      addr = 0x00000000;
     uint32      mask = 0xFFFFFFFF;
+    int		bitcnt;
 
-    // First get the network part of the address...
-    tmpStr = strtok(addrstr, "/");
-    addr = inet_addr(tmpStr);
-
-    tmpStr = strtok(NULL, "/");
-    if(tmpStr != NULL) {
-        int bitcnt = atoi(tmpStr);
-        if(bitcnt <= 0 || bitcnt > 32) {
-            log(LOG_WARNING, 0, "The bits part of the address is invalid : %d.",tmpStr);
-            return NULL;
-        }
-
-        mask <<= (32 - bitcnt);
-    }
-
-    if(addr == -1 || addr == 0) {
-        log(LOG_WARNING, 0, "Unable to parse address token '%s'.", addrstr);
+    bitcnt = inet_net_pton(AF_INET, addrstr, &addr, sizeof(addr));
+    if(bitcnt<0) {
+        log(LOG_WARNING, 0, "Unable to parse address token '%s'.",addrstr);
         return NULL;
-    }
+    } else if(bitcnt>0)
+	mask <<= (32 - bitcnt);
+    else
+	mask = 0;
 
     tmpSubnet = (struct SubnetList*) malloc(sizeof(struct SubnetList));
     tmpSubnet->subnet_addr = addr;
